package org.atlantis.grosbeak.lang.stream;

import java.io.IOException;
import java.io.OutputStream;

/**
 * 字符串输出流。将内容写入到一个StringBuilder中，然后通过get方法返回。
 * @author <a href="mailto:seenoevil.cn@gmail.com">SeeNoEvil</a>
 *
 */
public class StringOutputStream extends OutputStream {
	
	private StringBuilder sb;
	
	public StringOutputStream(StringBuilder sb) {
		this.sb = sb;
	}
	
	@Override
	public void write(int b) throws IOException {
		sb.append((char)b);
	}
	
	public StringBuilder get() {
		return sb;
	}
}
